/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package hxg.portmgr.core.samplerAndMonitor;

import hxg.portmgr.core.device.Device;
import hxg.portmgr.core.device.intf.Intf;
import hxg.portmgr.core.oper.snmp.SnmpOper;
import hxg.portmgr.core.oper.snmp.Value;
import hxg.portmgr.core.oper.snmp.oidgroup.FlowOID;
import hxg.portmgr.core.oper.snmp.param.Param;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;

/**
 *
 * @author hstel-hxg
 */
public abstract class FlowOidSampler implements Sampler {

    SnmpOper oper;
    List<Intf> infs = new ArrayList<>();

    public FlowOidSampler(Device dev) {
        oper = SnmpOper.getSnmpOper(dev);
    }

    public void addIntf(Intf... intfs) {
        this.infs.addAll(Arrays.asList(intfs));
    }

    public void removeIntf(Intf... intfs) {
        for (Intf inf : intfs) {
            this.infs.remove(inf);
        }
    }

    public void addIntfs(List<Intf> intfs) {
        this.infs.addAll(intfs);
    }

    public void removeIntfs(List<Intf> intfs) {
        this.infs.removeAll(intfs);
    }

    //final FlowOID[] getOidGroups() {
    //    return oper.getFlowEntries();
    //}
    @Override
    public abstract void executeSample(Param[] params);
//    {
//        try {
//            Map<String, EnumMap<FlowOID, Long>> mp = oper.getFlowCountTable(oper.getFlowEntries());
//
//        } catch (IOException ex) {
//            Logger.getLogger(FlowOidSampler.class.getName()).log(Level.SEVERE, null, ex);
//        }
//    }

    @Override
    public abstract Map<String, Map<Param, Value>> getSampleData(Param[] params);
}
